{extend name="public:base"/}

{block name="title"}商家菜单列表{/block}
{block name="style"}
<link href="__STATIC__/admin/css/jquery.treegrid.css" rel="stylesheet">
{/block}

{block name="main"}

<section class="content">

    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <h3 class="box-title">商家菜单列表</h3>
                </div>
                <!--
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="/backend/addons/rf-merchants/config/index"> 配置管理</a></li>
                        <li><a href="/backend/addons/rf-merchants/config-cate/index"> 配置分类</a></li>
                        <li class="pull-right">
                            <a class="btn btn-primary btn-xs" href="/backend/addons/rf-wechat/rule/edit"><i
                                    class="fa fa-plus"></i> 创建</a>
                        </li>
                    </ul>
                </div>
                -->

                <div class="clearfix"></div>

                <div class="box-body table-responsive">

                    <div class="menu-buttons">
                        <a href="{:url('admin/ShopPrivilege/create')}" class="btn btn-sm btn-primary"><i class="fa fa-plus"></i>新增商家菜单</a>
                    </div>

                    <table id="table-index" class="table table-hover"><thead>
                    <tr>
                        <th style="width: 20%;">商家菜单名称</th>
                        <th style="width: 10%;">ID</th>
                        <th style="width: 10%;">模块名称</th>
                        <th style="width: 10%;">控制器名称</th>
                        <th style="width: 10%;">方法名称</th>
                        <th style="width: 10%;">是否菜单</th>
                        <th style="width: 10%;">上级商家菜单ID</th>
                        <th style="width: 10%;">操作</th>
                    </tr>

                    </thead>
                        <tbody>
                        <?php if(!empty($privilegeData)){ foreach($privilegeData as $k=>$v){?>

                        <tr class="treegrid-<?=$v['id']?> <?=$v['parent_id'] == 0?'':'treegrid-parent-'.$v['parent_id']?>"  data-key="<?=$v['id']?>">
                            <td>
                                <span class="m-l-sm"><?=$v['pri_name']?></span>
                            </td>
                            <td><?=$v['id']?></td>
                            <td><?=$v['module_name']?></td>
                            <td><?=$v['controller_name']?></td>
                            <td><?=$v['action_name']?></td>
                            <td><?=$v['is_menu']?></td>
                            <td><?=$v['parent_id']?></td>
                            <td>
                                <a class="btn btn-primary btn-xs" href="{:url('admin/ShopPrivilege/update',['id'=>$v['id']])}">编辑</a>
                                <a class="btn btn-danger btn-xs" href="{:url('admin/ShopPrivilege/delete',['id'=>$v['id']])}" onclick="ptyConfirmDelete('{:url('admin/privilege/delete')}',{$v['id']});return false;">删除</a>
                            </td>
                        </tr>

                        <?php }} ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
</section>
{/block}

{block name="js"}
<script src="__STATIC__/admin/js/jquery.treegrid.min.js"></script>

<script>
    jQuery(function ($) {
        jQuery('#table-index').treegrid({"initialState": "collapsed"});
    });
</script>
{/block}